/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.concurrent.TimeUnit;

/**
 * <p>Project: app2022 - T7
 * <p>Powered by webrx On 2022-01-27 14:28:18
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class T7 {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String end = "2022-01-27 15:55:00";
        long e = sdf.parse(end).getTime();
        new Thread(() -> {
            System.out.println("关机程序启动...");
            System.out.println("服务器将在：" + end + "关机");
            try {
                TimeUnit.MILLISECONDS.sleep(e - System.currentTimeMillis());
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            System.out.println("关机成功");
        }, "tt").start();
    }
}
